home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------------+
- | |
- | FONT->NFNT.c |
- | |
- | This program is designed to convert FONT resources in a file to NFNT |
- | resources with the identical resource ID (assuming no ID conflict) and |
- | name, deleting the original FONT resources. It can also do the more |
- | general conversion from any one type of resource to any other resource |
- | type. This source code is free for you to modify and use, but as it |
- | is currently written (and compiled into the FONT->NFNT application |
- | accompanying this source), it is not Public Domain (i.e. you can use |
- | parts of this code as you wish in your own programs, but as written by |
- | me, you cannot distribute for any fee). |
- | |
- +----------------------------------------------------------------------------*/
-
- #ifndef _MacProtos_
- typedef ProcPtr FilterProc;
- #endif
-
- #ifndef _H_QuickSort
- #include "_QuickSort.h"
- #endif
-
-
- /* Defines--General */
- #define NIL_POINTER 0L
- #define NIL_HANDLE (Handle)NIL_POINTER
- #define NIL_ACTION_PROC NIL_POINTER
- #define NO_FILTER_PROC NIL_POINTER
- #define NIL_PROCPTR NIL_POINTER
- #define NIL_STRING (StringPtr)"\p"
- #define NIL_TITLE NIL_STRING
- #define NIL_REF_CON NIL_POINTER
-
- #define MOVE_TO_FRONT (WindowPtr)-1L
- #define REMOVE_ALL_EVENTS 0
- #define NORMAL_UPDATES TRUE
- #define PLAIN 0
- #define LEAVE_WHERE_IT_IS FALSE
-
- #define MIN_SLEEP 0L
- #define NIL_MOUSE_REGION 0L
- #define WNE_TRAP_NUM 0x60
- #define UNIMPL_TRAP_NUM 0x9F
-
- #define SCROLL_BAR_PIXEL_WIDTH 15
- #define WIDTH 2
-
- #define NO_ERR 0
- #define CANCELLED -1
-
- #define MOVE_RIGHT_ARROW_CHAR 0x1D /* -> */
- #define MOVE_LEFT_ARROW_CHAR 0x1C /* <- */
- #define MOVE_DOWN_ARROW_CHAR 0x1F /* down-arrow */
- #define MOVE_UP_ARROW_CHAR 0x1E /* up-arrow */
-
- #define BASE_RES_ID 400
-
-
- /* Defines--Menu */
- #define APPLE_ABOUT_ITEM 1
-
- #define FILE_FONTNFNT_ITEM 1
- #define FILE_CONVERT_ITEM 2
- #define FILE_QUIT_ITEM 4
-
- #define EDIT_UNDO_ITEM 1
- #define EDIT_CUT_ITEM 3
- #define EDIT_COPY_ITEM 4
- #define EDIT_PASTE_ITEM 5
- #define EDIT_CLEAR_ITEM 6
-
- #define NOT_A_NORMAL_MENU -1
- #define APPLE_MENU_ID BASE_RES_ID
- #define FILE_MENU_ID BASE_RES_ID+1
- #define EDIT_MENU_ID BASE_RES_ID+2
-
- #define WHOLE_MENU 0
-
-
- /* Defines--DLOG */
- #define ARE_YOU_SURE_DLOG_ID BASE_RES_ID
- #define ARE_YOU_SURE_DLOG_OK_ITEM 1
- #define ARE_YOU_SURE_DLOG_CANCEL_ITEM 2
- #define ARE_YOU_SURE_DLOG_ALL_ITEM 3
- #define ARE_YOU_SURE_DLOG_USER_ITEM 4
- #define ARE_YOU_SURE_DLOG_DEFAULT_ITEM 5
-
- #define ERROR_ALERT_ID BASE_RES_ID+1
- #define RES_ERROR_ALERT_ID BASE_RES_ID+2
-
- #define ABOUT_DLOG_ID BASE_RES_ID+3
- #define ABOUT_DLOG_OK_ITEM 1
- #define ABOUT_DLOG_PICT_ITEM 2
- #define ABOUT_DLOG_ICON_ITEM 3
- #define ABOUT_DLOG_DEFBUT_ITEM 4
- #define NUM_DLOG_ICONS 17
- #define BASE_ICON_ID 128
- #define BASE_PICT_ID 128
-
- #define UNIQUEID_ALERT_ID BASE_RES_ID+4
- #define UNIQUEID_ALERT_CANCEL_ITEM 1
- #define UNIQUEID_ALERT_OVERWRITE_ITEM 2
- #define UNIQUEID_ALERT_UNIQUEID_ITEM 3
-
- #define CHOOSE_RESTYPE_DLOG_ID BASE_RES_ID+5
- #define CHOOSE_RESTYPE_DLOG_OK_ITEM 1
- #define CHOOSE_RESTYPE_DLOG_CANCEL_ITEM 2
- #define CHOOSE_RESTYPE_DLOG_USER_ITEM 3
- #define CHOOSE_RESTYPE_DLOG_DEFBUT_ITEM 4
-
- #define NO_RESOURCES_ALRT_ID BASE_RES_ID+6
-
- #define CHOOSE_RESTYPE2_DLOG_ID BASE_RES_ID+7
- #define CHOOSE_RESTYPE2_DLOG_OK_ITEM 1
- #define CHOOSE_RESTYPE2_DLOG_CANCEL_ITEM 2
- #define CHOOSE_RESTYPE2_DLOG_TEXT_ITEM 3
- #define CHOOSE_RESTYPE2_DLOG_DEFBUT_ITEM 4
-
- #define SAME_TYPE_ALRT_ID BASE_RES_ID+8
-
- #define OPERATION_COMPLETE_ALRT_ID BASE_RES_ID+9
-
- /* Defines--STR# */
- #define DEFAULT_STRN_ID BASE_RES_ID
- #define DEFAULT_STRN_CONVERT 5
- #define DEFAULT_STRN_ARROW 6
- #define DEFAULT_STRN_CONVERSION 8
- #define DEFAULT_STRN_OPENING 10
- #define DEFAULT_STRN_HANDTOHAND 11
- #define OUT_OF_MEMORY 12
- #define CANT_GET_FONT_RESOURCE 13
- #define DEFAULT_STRN_RMVERESOURCE 14
- #define DEFAULT_STRN_SETHANDSIZE 15
- #define DEFAULT_STRN_ADDRESOURCE 16
- #define NO_MENU_BAR 20
- #define NO_APPLE_MENU 21
- #define NO_FILE_MENU 22
- #define NO_EDIT_MENU 23
- #define NO_ABOUT_ALERT 25
- #define BLANK_ALERT NO_MENU_BAR
-
- #define STYLE_STRN_ID BASE_RES_ID+1
-
-
-
-
- /* Macros */
- #define _PStrCopy(src,dest) BlockMove(src,dest,src[0]+1)
- #define _LongToPString(theLong,theString) theString[0]=4;BlockMove(&theLong,theString+1,4)
- #define _PStringToLong(theString,theLong) BlockMove(theString+1,&theLong,4)
-
-
-
- /* Structures */
- struct resourceData { Handle handle;
- int ID;
- Str255 name;
- Boolean useThisOne;
- };
- typedef struct resourceData ResourceData;
- typedef ResourceData *ResourceDataPtr;
- #define RESOURCEDATA_SIZE sizeof(ResourceData)
-
-
-
- /* Global Declarations */
- ListHandle _gListH;
- Point _gWhere;
- pascal Boolean _MyModalProc();
- pascal Boolean _ChooseResType2ModalProc();
- int _MenuBarInit();
- int _gModifiers;
- Rect _gListRect;
- MenuHandle _gAppleMenuH;
- MenuHandle _gFileMenuH;
- MenuHandle _gEditMenuH;
- Boolean _gWNEImplemented, _gDone, _gAll;
- EventRecord _gTheEvent;
- Handle *_gPictH, _gIconH[NUM_DLOG_ICONS];
- int _gPictNum, _gIconNum, _gReverse;
-
-
- /********** MAIN **********/
- main()
- {int _errStrNum;
- _ToolBoxInit();
- if ((_errStrNum=_MenuBarInit())==NO_ERR)
- _MainLoop();
- else
- _DoErrorDialog( 0, _errStrNum, NIL_STRING);
- }
-
-
-
- /*********** ToolBoxInit */
- _ToolBoxInit()
- {pascal void _RestartProc();
- MaxApplZone();
- InitGraf( (Ptr) &thePort);
- InitFonts();
- FlushEvents( everyEvent, 0);
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs( (ProcPtr)_RestartProc );
- InitCursor();
- }
-
-
-
- /* when the world comes to an end */
- pascal void _RestartProc() { ExitToShell(); }
-
-
-
-
-
-
- /************* MenuBarInit *********/
- /* init the menu-bar and return TRUE if error-free */
- int _MenuBarInit()
- {Handle _myMenuBar;
- Boolean _error;
- int _errno;
-
- _myMenuBar = GetNewMBar( BASE_RES_ID );
- if (_myMenuBar==NIL_HANDLE)
- return( NO_MENU_BAR );
- SetMenuBar( _myMenuBar );
- _gAppleMenuH = GetMHandle( APPLE_MENU_ID );
- if (_gAppleMenuH==(MenuHandle)NIL_HANDLE)
- return( NO_APPLE_MENU );
- AddResMenu( _gAppleMenuH, 'DRVR' );
- _gFileMenuH = GetMHandle( FILE_MENU_ID );
- if (_gFileMenuH==(MenuHandle)NIL_HANDLE)
- return( NO_APPLE_MENU );
- _gEditMenuH = GetMHandle( EDIT_MENU_ID );
- if (_gEditMenuH==(MenuHandle)NIL_HANDLE)
- return( NO_EDIT_MENU );
- DrawMenuBar();
- return( NO_ERR );
- }
-
-
-
-
-
-
- /********************* Do Error Dialog ***************/
- _DoErrorDialog( _errno, _errStrNum, _fn )
- int _errno, _errStrNum;
- Str255 _fn;
- {Str255 _theString, _theErrNoString;
- if (_errStrNum >= BLANK_ALERT)
- { GetIndString( _theString, DEFAULT_STRN_ID, _errStrNum );
- ParamText( _theString, NIL_STRING, NIL_STRING, NIL_STRING );
- if (StopAlert( RES_ERROR_ALERT_ID, NIL_POINTER ) != 1)
- SysBeep(20);
- }
- else
- { NumToString( (long)_errno, _theErrNoString );
- GetIndString( _theString, DEFAULT_STRN_ID, _errStrNum );
- ParamText( _theErrNoString, _theString, _fn, NIL_STRING );
- if (StopAlert( ERROR_ALERT_ID, NIL_POINTER ) != 1)
- SysBeep(20);
- }
- }
-
-
-
-
- /*************** MainLoop ***************/
- _MainLoop()
- { _gWNEImplemented = ( NGetTrapAddress( WNE_TRAP_NUM, ToolTrap) !=
- NGetTrapAddress( UNIMPL_TRAP_NUM, ToolTrap ) );
- _gDone = FALSE;
- while (!_gDone)
- _HandleEvent();
- }
-
-
-
- /*************** HandleEvent ***********/
- _HandleEvent()
- {char _theChar;
- WindowPtr _whichWindow;
- int _thePart;
- long _menuChoice;
- Boolean _cmdKey, _optionKey, _shiftKey, _controlKey, _alphaLock;
-
- if (_gWNEImplemented)
- WaitNextEvent( everyEvent, &_gTheEvent, MIN_SLEEP, NIL_MOUSE_REGION);
- else
- { SystemTask();
- GetNextEvent( everyEvent, &_gTheEvent );
- }
- switch (_gTheEvent.what)
- { case nullEvent:
- _HandleNull();
- break;
- case mouseDown:
- _thePart = FindWindow( _gTheEvent.where, &_whichWindow );
- if (_thePart == inMenuBar)
- { _menuChoice = MenuSelect( _gTheEvent.where );
- _HandleMenuChoice( _menuChoice );
- }
- break;
- case keyDown:
- case autoKey:
- _theChar = _gTheEvent.message & charCodeMask;
- _cmdKey = ( (_gTheEvent.modifiers & cmdKey) != 0 );
- _optionKey = ( (_gTheEvent.modifiers & optionKey) != 0 );
- _shiftKey = ( (_gTheEvent.modifiers & shiftKey) != 0 );
- _controlKey = ( (_gTheEvent.modifiers & controlKey) != 0 );
- _alphaLock = ( (_gTheEvent.modifiers & alphaLock) != 0 );
- if ( _cmdKey )
- _HandleMenuChoice( MenuKey(_theChar) );
- if ( (!_optionKey) && (!_shiftKey) && _alphaLock &&
- ( (_controlKey&&(!_cmdKey)&&(_theChar=0x03)) ||
- ((!_controlKey)&&_cmdKey&&(_theChar='.' )) ) )
- _gDone = TRUE;
- break;
- }
- }
-
-
-
-
- /************* HandleNull ***************/
- _HandleNull()
- {
- }
-
-
-
-
-
-
- /********** HandleMenuChoice *********/
- _HandleMenuChoice( _menuChoice )
- long int _menuChoice;
- {int _theMenu, _theItem;
- if (_menuChoice != 0)
- { _theMenu = HiWord( _menuChoice );
- _theItem = LoWord( _menuChoice );
- switch (_theMenu)
- { case APPLE_MENU_ID:
- _HandleAppleChoice( _theItem );
- break;
- case FILE_MENU_ID:
- _HandleFileChoice( _theItem );
- break;
- case EDIT_MENU_ID:
- break;
- }
- HiliteMenu( 0 );
- }
- }
-
-
-
- /********************* Draw Default Button ***************/
- pascal void _DrawDefaultButton( _theDialog, _theItem )
- DialogPtr _theDialog;
- int _theItem;
- {int _itemType;
- Handle _itemH;
- Rect _itemRect;
- GetDItem( _theDialog, _theItem, &_itemType, &_itemH, &_itemRect );
- PenSize( 3, 3 );
- FrameRoundRect( &_itemRect, 16, 16 );
- }
-
-
-
-
- /********************* Draw PICT ***************/
- pascal void _DrawPICT( _theDialog, _theItem )
- DialogPtr _theDialog;
- int _theItem;
- {int _itemType;
- Handle _itemH;
- Rect _itemRect;
- GetDItem( _theDialog, _theItem, &_itemType, &_itemH, &_itemRect );
- DrawPicture( (PicHandle)_gPictH[_gPictNum], &_itemRect );
- }
-
-
-
-
- /********************* Draw ICON ***************/
- pascal void _DrawICON( _theDialog, _theItem )
- DialogPtr _theDialog;
- int _theItem;
- {int _itemType;
- Handle _itemH;
- Rect _itemRect;
- GetDItem( _theDialog, _theItem, &_itemType, &_itemH, &_itemRect );
- PlotIcon( &_itemRect, _gIconH[_gIconNum] );
- }
-
-
-
-
- /************** HandleAppleChoice **********/
- _HandleAppleChoice( _theItem )
- int _theItem;
- {Str255 _accName;
- int _accNumber, _itemHit, i, j, _itemType, _numPICTs;
- Handle _itemH;
- Rect _box, _pictBox;
- RgnHandle _upRgn, _pictRgn;
- long int _count;
- short int _itemNumber;
- DialogPtr _aboutDialogP;
- Boolean _dialogDone;
- GrafPtr _oldPort;
- switch (_theItem)
- { case APPLE_ABOUT_ITEM:
- _aboutDialogP = GetNewDialog( ABOUT_DLOG_ID, NIL_POINTER,
- MOVE_TO_FRONT );
- if (_aboutDialogP == (DialogPtr) NIL_POINTER)
- _DoErrorDialog( 0, NO_ABOUT_ALERT, NIL_STRING );
- _dialogDone = FALSE;
- GetDItem( _aboutDialogP, ABOUT_DLOG_DEFBUT_ITEM,
- &_itemType, &_itemH, &_box );
- SetDItem( _aboutDialogP, ABOUT_DLOG_DEFBUT_ITEM,
- _itemType, (Handle)_DrawDefaultButton, &_box );
- GetDItem( _aboutDialogP, ABOUT_DLOG_PICT_ITEM,
- &_itemType, &_itemH, &_pictBox );
- SetDItem( _aboutDialogP, ABOUT_DLOG_PICT_ITEM,
- _itemType, (Handle)_DrawPICT, &_pictBox );
- _pictRgn = NewRgn();
- RectRgn( _pictRgn, &_pictBox );
- _gPictNum = 0;
- _numPICTs = Count1Resources( 'PICT' );
- _gPictH = (Handle *) NewPtr( _numPICTs * sizeof(Handle) );
- for (i=0; i<_numPICTs; i++)
- _gPictH[i] = (Handle) GetPicture(i+BASE_PICT_ID);
- GetDItem( _aboutDialogP, ABOUT_DLOG_ICON_ITEM,
- &_itemType, &_itemH, &_box );
- SetDItem( _aboutDialogP, ABOUT_DLOG_ICON_ITEM,
- _itemType, (Handle)_DrawICON, &_box );
- _gIconNum = 0;
- for (i=0; i<NUM_DLOG_ICONS; i++)
- _gIconH[i] = GetIcon(i+BASE_ICON_ID);
- _upRgn = NewRgn();
- RectRgn( _upRgn, &_box );
- ShowWindow( _aboutDialogP );
- while (!(_dialogDone))
- { ModalDialog( NIL_POINTER, &_itemHit );
- switch ( _itemHit )
- { case ABOUT_DLOG_OK_ITEM:
- _dialogDone = TRUE;
- break;
- case ABOUT_DLOG_PICT_ITEM:
- if (++_gPictNum >= _numPICTs) _gPictNum=0;
- UpdtDialog( _aboutDialogP, _pictRgn );
- break;
- case ABOUT_DLOG_ICON_ITEM:
- if (_gPictNum != 0)
- { _gPictNum = 0;
- UpdtDialog( _aboutDialogP, _pictRgn );
- }
- for (i=0; i<NUM_DLOG_ICONS; i++)
- { _gIconNum = i;
- UpdtDialog( _aboutDialogP, _upRgn );
- _Pause( 1L );
- }
- _Pause( 5L );
- for (i=NUM_DLOG_ICONS-1; i>=0; i--)
- { _gIconNum = i;
- UpdtDialog( _aboutDialogP, _upRgn );
- _Pause( 1L );
- }
- _gIconNum = 0;
- UpdtDialog( _aboutDialogP, _upRgn );
- break;
- }
- }
- for (i=0; i<_numPICTs; i++)
- ReleaseResource( _gPictH[i] );
- DisposPtr( (Ptr)_gPictH );
- for (i=0; i<NUM_DLOG_ICONS; i++)
- ReleaseResource( _gIconH[i] );
- DisposHandle( (Handle) _upRgn );
- DisposDialog( _aboutDialogP );
- break;
- default:
- GetItem( _gAppleMenuH, _theItem, _accName );
- EnableItem( _gEditMenuH, WHOLE_MENU );
- _accNumber = OpenDeskAcc( _accName );
- DisableItem( _gEditMenuH, WHOLE_MENU );
- break;
- }
- }
-
-
-
-
- /***************** Handle File Choice ***************/
- _HandleFileChoice( _theItem )
- int _theItem;
- { switch (_theItem)
- { case FILE_FONTNFNT_ITEM:
- case FILE_CONVERT_ITEM:
- _ChangeFONTtoNFNT( _theItem );
- break;
- case FILE_QUIT_ITEM:
- _gDone = TRUE;
- break;
- }
- }
-
-
-
-
- /********************* Draw List ***************/
- pascal void _DrawList( _theDialog, _theItem )
- DialogPtr _theDialog;
- int _theItem;
- {int _itemType;
- Handle _itemH;
- Rect _itemRect;
- GetDItem( _theDialog, _theItem, &_itemType, &_itemH, &_itemRect );
- PenSize( 1, 1 );
- FrameRect( &_itemRect );
- InsetRect( &_itemRect, WIDTH, WIDTH );
- FrameRect( &_itemRect );
- LUpdate( _theDialog->visRgn, _gListH );
- }
-
-
-
-
- /************** Add Num *****************/
- _AddNum( _dataPtr, _len, _theNum, _chars )
- char *_dataPtr;
- int *_len;
- long _theNum;
- int _chars;
- {int i;
- Str255 _string;
- NumToString( _theNum, _string );
- for (i=1; (i+_string[0])<=_chars; i++)
- _dataPtr[(*_len)++] = 0xCA;
- for (i=1; i<=_string[0]; i++)
- _dataPtr[(*_len)++] = _string[i];
- _dataPtr[(*_len)++] = 0xCA;
- _dataPtr[(*_len)++] = 0xCA;
- _dataPtr[(*_len)++] = 0xCA;
- }
-
-
-
-
-
-
- /****************** Pause ********************/
- _Pause( _ticks )
- long int _ticks;
- { _ticks += TickCount();
- while (TickCount() < _ticks);
- }
-
-
-
-
- /************** Flash Control *************/
- _FlashControl( _itemH )
- ControlHandle _itemH;
- { HiliteControl( _itemH, 1);
- _Pause( 15L );
- HiliteControl( _itemH, 0);
- _Pause( 5L );
- }
-
-
-
- /*********************** Unique 1 ID *****************/
- int _Unique1ID( _theType )
- ResType _theType;
- {int _theID;
- _theID = 0;
- while (_theID < 128)
- _theID = Unique1ID( _theType );
- return( _theID );
- }
-
-
-
-
-
- /*************** Get ResType1 *****************/
- Boolean _GetResType1( _type1, _fn, _answer, _errStrNum )
- ResType *_type1;
- Str255 _fn;
- int *_answer;
- int *_errStrNum;
- {int _numTypes, i, j, _num, _len;
- DialogPtr _dialogPtr;
- Boolean _dialogDone, _ok;
- ResType *_type, _theType;
- long _mask;
- int _itemHit;
- int _itemType;
- Handle _itemH;
- Rect _itemRect;
- Rect _dataBounds;
- Point _cSize;
- char _dataPtr[256];
- Str255 _string, _oldString;
-
- *_errStrNum = NO_ERR;
- _numTypes = Count1Types();
- if (_numTypes <= 0)
- { ParamText( NIL_STRING, _fn, NIL_STRING, NIL_STRING );
- CautionAlert( NO_RESOURCES_ALRT_ID, NIL_POINTER );
- return( FALSE );
- }
- _dialogPtr = GetNewDialog( CHOOSE_RESTYPE_DLOG_ID,
- NIL_POINTER, MOVE_TO_FRONT );
- GetDItem( _dialogPtr, CHOOSE_RESTYPE_DLOG_DEFBUT_ITEM,
- &_itemType, &_itemH, &_itemRect );
- SetDItem( _dialogPtr, CHOOSE_RESTYPE_DLOG_DEFBUT_ITEM,
- _itemType, (Handle)_DrawDefaultButton, &_itemRect );
- GetDItem( _dialogPtr, CHOOSE_RESTYPE_DLOG_USER_ITEM,
- &_itemType, &_itemH, &_itemRect );
- SetDItem( _dialogPtr, CHOOSE_RESTYPE_DLOG_USER_ITEM,
- _itemType, (Handle)_DrawList, &_itemRect );
- _dataBounds.top = 0;
- _dataBounds.left = 0;
- _dataBounds.bottom = _numTypes;
- _dataBounds.right = 1;
- _cSize.v = 0;
- _cSize.h = 0;
- InsetRect( &_itemRect, WIDTH+1, WIDTH+1 );
- _gListRect = _itemRect;
- _gListRect.right -= SCROLL_BAR_PIXEL_WIDTH;
- _gListH = LNew( &_gListRect, &_dataBounds, _cSize, 0,
- _dialogPtr, FALSE, FALSE, FALSE, TRUE );
- /* error check. if error dispose dialog */
- (*_gListH)->selFlags = lOnlyOne; /* only one selection at a time */
- _cSize.h = 0;
- _type = (ResType *) NewPtr( _numTypes * sizeof(ResType) );
- if ((*_answer=MemError()) != noErr)
- { LDispose( _gListH );
- DisposDialog( _dialogPtr );
- return( OUT_OF_MEMORY );
- }
- for (i=0; i<_numTypes; i++)
- Get1IndType( &(_type[i]), i+1 );
-
- _QuickSort( _numTypes, ASCENDING, 1, LONG, _type );
-
- for (i=0; i<_numTypes; i++)
- { _len = 0;
- _num = Count1Resources( _type[i] );
- _AddNum( _dataPtr, &_len, (long)_num, 5 );
- _theType = _type[i];
- _mask = 0x000000FF;
- for (j=3; j>=0; j--)
- { _dataPtr[_len+j] = (char) (_theType & _mask);
- _theType = _theType >> 8;
- }
- _len += 4;
- _cSize.v = i;
- LSetCell( _dataPtr, _len, _cSize, _gListH );
- LSetSelect( FALSE, _cSize, _gListH );
- }
- _cSize.v = 0;
- LSetSelect( TRUE, _cSize, _gListH );
-
- ShowWindow( _dialogPtr );
- LDoDraw( TRUE, _gListH );
- _dialogDone = FALSE;
- _gAll = FALSE;
- _ok = TRUE;
- while (!_dialogDone)
- { ModalDialog( (FilterProc)_MyModalProc, &_itemHit );
- switch ( _itemHit )
- { case CHOOSE_RESTYPE_DLOG_OK_ITEM:
- _dialogDone = TRUE;
- break;
- case CHOOSE_RESTYPE_DLOG_CANCEL_ITEM:
- _dialogDone = TRUE;
- _ok = FALSE;
- break;
- case CHOOSE_RESTYPE_DLOG_USER_ITEM:
- _dialogDone = LClick( _gWhere, _gModifiers, _gListH );
- break;
- }
- }
- if (_ok)
- { _cSize.h = 0;
- _cSize.v = 0;
- if ((_ok=LGetSelect( TRUE, &_cSize, _gListH )))
- *_type1 = _type[_cSize.v];
- }
- LDispose( _gListH );
- DisposDialog( _dialogPtr );
- DisposPtr( _type );
- return( _ok );
- }
-
-
-
-
-
-
- /*************** Get ResType2 *****************/
- Boolean _GetResType2( _type1, _type2, _answer, _errStrNum )
- ResType *_type1, *_type2;
- int *_answer, *_errStrNum;
- {int _numTypes;
- DialogPtr _dialogPtr;
- Boolean _dialogDone;
- int _itemHit;
- int _itemType;
- Handle _itemH;
- Rect _itemRect;
- Str255 _string, _oldString;
-
- *_errStrNum = NO_ERR;
- _dialogPtr = GetNewDialog( CHOOSE_RESTYPE2_DLOG_ID,
- NIL_POINTER, MOVE_TO_FRONT );
- _LongToPString( (*_type1), _string );
- ParamText( _string, NIL_STRING, NIL_STRING, NIL_STRING );
- GetDItem( _dialogPtr, CHOOSE_RESTYPE2_DLOG_DEFBUT_ITEM,
- &_itemType, &_itemH, &_itemRect );
- SetDItem( _dialogPtr, CHOOSE_RESTYPE2_DLOG_DEFBUT_ITEM,
- _itemType, (Handle)_DrawDefaultButton, &_itemRect );
- GetDItem( _dialogPtr, CHOOSE_RESTYPE2_DLOG_TEXT_ITEM,
- &_itemType, &_itemH, &_itemRect );
- ShowWindow( _dialogPtr );
- _dialogDone = FALSE;
- while (!_dialogDone)
- { ModalDialog( (FilterProc)_ChooseResType2ModalProc, &_itemHit );
- GetIText( _itemH, _string );
- if (_string[0] > 4)
- { SysBeep(20);
- SetIText( _itemH, _oldString );
- _itemHit = 0;
- }
- else
- BlockMove( _string, _oldString, _string[0]+1 );
- switch (_itemHit)
- { case CHOOSE_RESTYPE2_DLOG_OK_ITEM:
- while (_string[0] < 4) _string[++_string[0]] = 0x20;
- _PStringToLong( _string , (*_type2) );
- if (*_type1 == *_type2)
- { ParamText( _string, NIL_STRING,
- NIL_STRING, NIL_STRING );
- NoteAlert( SAME_TYPE_ALRT_ID, NIL_POINTER );
- }
- else
- _dialogDone = TRUE;
- break;
- case CHOOSE_RESTYPE2_DLOG_CANCEL_ITEM:
- _dialogDone = TRUE;
- break;
- }
- }
- DisposDialog( _dialogPtr );
- return( _itemHit==CHOOSE_RESTYPE2_DLOG_OK_ITEM );
- }
-
-
-
-
- /********** Open The Resource File ********/
- Boolean _OpenTheResourceFile( _fileName, _theItem, _vRef2 )
- Str255 _fileName;
- int _theItem;
- int *_vRef2;
- {SFTypeList _myTypes;
- SFReply _reply;
- Point _SFGwhere = { 90, 82 };
- Point _SFPwhere = { 106, 104 };
- int _vRef, _numTypes;
- Boolean _answer;
-
- _answer = FALSE;
- if (_theItem == FILE_FONTNFNT_ITEM)
- { _numTypes = 2;
- _myTypes[0] = 'FFIL';
- _myTypes[1] = 'rsrc';
- }
- else
- _numTypes = -1;
- _reply.good = FALSE;
- SFGetFile( _SFGwhere, NIL_STRING, NO_FILTER_PROC, _numTypes, &_myTypes,
- NIL_PROCPTR, &_reply);
- if (_reply.good)
- { _PStrCopy( _reply.fName, _fileName );
- _vRef = _reply.vRefNum;
- *_vRef2 = OpenRFPerm( _fileName, _vRef, fsRdWrPerm );
- if (*_vRef2 >= noErr)
- { UseResFile( *_vRef2 );
- _answer = TRUE;
- }
- }
- return( _answer );
- }
-
-
-
-
-
-
- /************* Choose Resources **************/
- Boolean _ChooseResources( _type1, _type2, _type2String, _buttonString, _fn,
- _convertReverseString, _numResources,
- _theResourceDataArray, _answer, _errStrNum )
- ResType _type1, _type2;
- Str255 _type2String;
- Str255 _buttonString;
- Str255 _fn;
- Str255 _convertReverseString;
- int *_numResources;
- ResourceDataPtr *_theResourceDataArray;
- int *_answer, *_errStrNum;
- {Str255 _type1String;
- int i, j, _theID;
- Boolean _continue;
-
- DialogPtr _dialogPtr;
- Boolean _dialogDone;
- int _itemHit;
- int _itemType;
- Handle _itemH;
- Rect _itemRect;
-
- long _size;
- int _len;
- ResType _theType;
- char _dataPtr[256];
- Rect _dataBounds;
- Point _cSize;
-
- *_errStrNum = NO_ERR;
- *_numResources = Count1Resources( _type1 );
- if (*_numResources == 0 )
- { _LongToPString( _type1, _type1String );
- _type1String[++_type1String[0]] = 0x20;
- ParamText( _type1String, _fn, NIL_STRING, NIL_STRING );
- CautionAlert( NO_RESOURCES_ALRT_ID, NIL_POINTER );
- return( FALSE );
- }
-
- *_theResourceDataArray = (ResourceDataPtr) NewPtr( (*_numResources) *
- RESOURCEDATA_SIZE );
- if ((*_answer=MemError()) != noErr)
- { *_errStrNum = OUT_OF_MEMORY;
- return( FALSE );
- }
-
- _dialogPtr = GetNewDialog( ARE_YOU_SURE_DLOG_ID, NIL_POINTER, MOVE_TO_FRONT);
- GetDItem( _dialogPtr, ARE_YOU_SURE_DLOG_DEFAULT_ITEM,
- &_itemType, &_itemH, &_itemRect );
- SetDItem( _dialogPtr, ARE_YOU_SURE_DLOG_DEFAULT_ITEM,
- _itemType, (Handle)_DrawDefaultButton, &_itemRect );
- GetDItem( _dialogPtr, ARE_YOU_SURE_DLOG_OK_ITEM,
- &_itemType, &_itemH, &_itemRect );
- SetCTitle( (ControlHandle)_itemH, _buttonString );
- GetDItem( _dialogPtr, ARE_YOU_SURE_DLOG_USER_ITEM,
- &_itemType, &_itemH, &_itemRect );
- SetDItem( _dialogPtr, ARE_YOU_SURE_DLOG_USER_ITEM,
- _itemType, (Handle)_DrawList, &_itemRect );
- _dataBounds.top = 0;
- _dataBounds.left = 0;
- _dataBounds.bottom = *_numResources;
- _dataBounds.right = 1;
- _cSize.v = 0;
- _cSize.h = 0;
- InsetRect( &_itemRect, WIDTH+1, WIDTH+1 );
- _gListRect = _itemRect;
- _gListRect.right -= SCROLL_BAR_PIXEL_WIDTH;
- _gListH = LNew( &_gListRect, &_dataBounds, _cSize, 0, _dialogPtr,
- FALSE, FALSE, FALSE, TRUE );
-
- _cSize.h = 0;
- _continue = TRUE;
- for (i=0; ((i<*_numResources) && _continue); i++)
- { (*_theResourceDataArray)[i].handle = Get1IndResource( _type1, i+1 );
- *_answer = ResError();
- if ( (_continue = (*_answer==noErr)) )
- GetResInfo( (*_theResourceDataArray)[i].handle,
- &((*_theResourceDataArray)[i].ID), &_theType,
- (*_theResourceDataArray)[i].name );
- else
- *_errStrNum = CANT_GET_FONT_RESOURCE;
- }
-
- _QuickSort( *_numResources, ASCENDING, 1, RESDATA, *_theResourceDataArray );
-
- for (i=0; ((i<*_numResources) && _continue); i++)
- { _size = GetHandleSize( (*_theResourceDataArray)[i].handle );
- _len = 0;
- _AddNum( _dataPtr, &_len, (long)((*_theResourceDataArray)[i].ID), 6);
- _AddNum( _dataPtr, &_len, _size, 6 );
- for (j=1; j<=((*_theResourceDataArray)[i].name)[0]; j++)
- _dataPtr[_len++] = ((*_theResourceDataArray)[i].name)[j];
- _cSize.v = i;
- LSetCell( _dataPtr, _len, _cSize, _gListH );
- LSetSelect( TRUE, _cSize, _gListH );
- }
-
- if (_continue)
- { _LongToPString( _type1, _type1String );
- ParamText( _convertReverseString, _type1String, _type2String, _fn );
- LDoDraw( TRUE, _gListH );
- ShowWindow( _dialogPtr );
- }
- _dialogDone = FALSE;
- _gAll = TRUE;
- while ((!(_dialogDone) && _continue))
- { ModalDialog( (FilterProc)_MyModalProc, &_itemHit );
- switch ( _itemHit )
- { case ARE_YOU_SURE_DLOG_CANCEL_ITEM:
- _continue = FALSE;
- case ARE_YOU_SURE_DLOG_OK_ITEM:
- _dialogDone = TRUE;
- break;
- case ARE_YOU_SURE_DLOG_USER_ITEM:
- LClick( _gWhere, _gModifiers, _gListH );
- break;
- case ARE_YOU_SURE_DLOG_ALL_ITEM:
- _cSize.h = 0;
- for (i=0; i<*_numResources; i++)
- { _cSize.v = i;
- LSetSelect( TRUE, _cSize, _gListH );
- }
- break;
- }
- }
- if ((_itemHit == ARE_YOU_SURE_DLOG_OK_ITEM) && _continue)
- { _cSize.h = 0;
- for (i=0; i<*_numResources; i++)
- { _cSize.v = i;
- if (! ( (*_theResourceDataArray)[i].useThisOne =
- ( LGetSelect( FALSE, &_cSize, _gListH ) &&
- ((*_theResourceDataArray)[i].handle != NIL_HANDLE) )))
- ReleaseResource( (*_theResourceDataArray)[i].handle );
- }
- }
- LDispose( _gListH );
- DisposDialog( _dialogPtr );
- return( _continue );
- }
-
-
-
-
-
- /****************** Do Convert *******************/
- Boolean _DoConvert( _theResourceDataPtr, _ignoreZero, _type1, _type2,
- _answer, _errStrNum )
- ResourceDataPtr _theResourceDataPtr;
- Boolean _ignoreZero;
- ResType _type1, _type2;
- int *_answer, *_errStrNum;
- {int _err, i;
- Boolean _doAddResource, _isNoError;
- Str255 _type1String, _type2String, _theIDStr;
-
- Handle _handle, _newHandle;
- int _ID;
-
- *_errStrNum = NO_ERR;
- _handle = _theResourceDataPtr->handle;
- _ID = _theResourceDataPtr->ID;
- if ( (GetHandleSize(_handle)>(Size)0) || (!_ignoreZero) )
- { _newHandle = NIL_HANDLE;
- _newHandle = Get1Resource( _type2, _ID );
- _err = ResError();
- _doAddResource = TRUE;
- _isNoError = TRUE;
- if ( (_newHandle!=NIL_HANDLE) || ((_err!=resNotFound)&&(_err!=noErr)) )
- { NumToString( (long)_ID, _theIDStr );
- _LongToPString( _type1, _type1String );
- _LongToPString( _type2, _type2String );
- _type1String[++_type1String[0]] = ' ';
- _type1String[++_type1String[0]] = 'I';
- _type1String[++_type1String[0]] = 'D';
- _type1String[++_type1String[0]] = '#';
- for (i=1; i<=_theIDStr[0]; i++)
- _type1String[++_type1String[0]] = _theIDStr[i];
- ParamText( _type2String, _type1String, _type2String, _theIDStr );
- switch ( CautionAlert(UNIQUEID_ALERT_ID,NIL_POINTER) )
- { case UNIQUEID_ALERT_CANCEL_ITEM:
- _doAddResource = FALSE;
- ReleaseResource( _handle );
- ReleaseResource( _newHandle );
- break;
- case UNIQUEID_ALERT_OVERWRITE_ITEM:
- SetHandleSize( _newHandle, GetHandleSize(_handle) );
- if (_isNoError = ((*_answer=MemError())==noErr))
- { BlockMove( *_handle, *_newHandle,
- GetHandleSize(_handle) );
- ChangedResource( _newHandle );
- RmveResource( _handle );
- if (!(_isNoError = ((*_answer=ResError())==noErr)))
- { *_errStrNum = DEFAULT_STRN_RMVERESOURCE;
- ReleaseResource( _handle );
- }
- }
- else
- { *_errStrNum = DEFAULT_STRN_SETHANDSIZE;
- ReleaseResource( _newHandle );
- ReleaseResource( _handle );
- }
- _doAddResource = FALSE;
- break;
- case UNIQUEID_ALERT_UNIQUEID_ITEM:
- _ID = _Unique1ID( _type2 );
- ReleaseResource( _newHandle );
- break;
- }
- }
- if (_doAddResource && _isNoError)
- { _newHandle = _handle;
- if (_isNoError=((*_answer=HandToHand(&_newHandle))==noErr))
- { AddResource( _newHandle, _type2, _ID,
- _theResourceDataPtr->name );
- if (_isNoError= ((*_answer=ResError())==noErr))
- { RmveResource( _handle );
- if (!(_isNoError = ((*_answer=ResError())==noErr)))
- { *_errStrNum=DEFAULT_STRN_RMVERESOURCE;
- ReleaseResource( _handle );
- }
- }
- else
- { *_errStrNum = DEFAULT_STRN_ADDRESOURCE;
- DisposHandle( _newHandle );
- ReleaseResource( _handle );
- }
- }
- else
- { *_errStrNum = DEFAULT_STRN_HANDTOHAND;
- ReleaseResource( _handle );
- }
- }
- }
- return( _isNoError );
- }
-
-
-
-
-
-
-
- /********** Change FONT to NFNT **********/
- _ChangeFONTtoNFNT( _theItem )
- int _theItem;
- {int _vRef, _errStrNum, _answer, _numResources, i;
- ResourceDataPtr _theResourceDataArray;
- Boolean _continue, _ignoreZero;
- Str255 _fn, _type2String, _convertReverseString, _buttonString;
- Str255 _conversionReversalString, _type1String;
- ResType _type1, _type2;
-
-
- _continue = TRUE;
-
- if (!_OpenTheResourceFile( _fn, _theItem, &_vRef ))
- { if (_vRef < noErr)
- { _answer = ResError();
- _errStrNum = DEFAULT_STRN_OPENING;
- _continue = FALSE;
- }
- }
- else
- { switch (_theItem)
- { case FILE_FONTNFNT_ITEM:
- _type1 = 'FONT';
- _type2 = 'NFNT';
- break;
- case FILE_CONVERT_ITEM:
- if ( (_continue=
- _GetResType1(&_type1,_fn,&_answer,&_errStrNum) ) )
- _continue = _GetResType2( &_type1, &_type2,
- &_answer, &_errStrNum );
- break;
- }
- if (_continue)
- { switch (_theItem)
- { case FILE_FONTNFNT_ITEM:
- case FILE_CONVERT_ITEM:
- GetIndString( _convertReverseString, DEFAULT_STRN_ID,
- DEFAULT_STRN_CONVERT );
- GetIndString( _conversionReversalString,
- DEFAULT_STRN_ID,
- DEFAULT_STRN_CONVERSION );
- GetIndString( _type2String, DEFAULT_STRN_ID,
- DEFAULT_STRN_ARROW );
- BlockMove( &_type2, _type2String+_type2String[0]+1, 4 );
- _type2String[0] += 4;
- _LongToPString( _type1, _buttonString );
- BlockMove( &_type2, _buttonString+7, 4 );
- _buttonString[0] = 10;
- _buttonString[5] = '-';
- _buttonString[6] = '>';
- break;
- }
- _continue = _ChooseResources( _type1, _type2, _type2String,
- _buttonString, _fn,
- _convertReverseString,
- &_numResources, &_theResourceDataArray,
- &_answer, &_errStrNum );
- }
- if (_continue)
- { _ignoreZero = FALSE;
- switch (_theItem)
- { case FILE_FONTNFNT_ITEM:
- _ignoreZero = TRUE;
- case FILE_CONVERT_ITEM:
- for (i=0; ( (i<_numResources) && (_continue)); i++)
- if (_theResourceDataArray[i].useThisOne)
- _continue=_DoConvert(&(_theResourceDataArray[i]),
- _ignoreZero, _type1, _type2,
- &_answer, &_errStrNum );
- while (i<_numResources)
- if (_theResourceDataArray[i].useThisOne)
- ReleaseResource(_theResourceDataArray[i].handle);
- break;
- }
- DisposPtr( _theResourceDataArray );
- }
- CloseResFile( _vRef );
- }
- if (_continue)
- { _LongToPString( _type1, _type1String );
- ParamText( _conversionReversalString, _type1String, _type2String, _fn );
- NoteAlert( OPERATION_COMPLETE_ALRT_ID, NIL_POINTER );
- }
- else if ((!_continue) && (_errStrNum != NO_ERR))
- _DoErrorDialog( _answer, _errStrNum, _fn );
- }
-
-
-
-
-
- /*********************** Choose ResType2 Modal Proc *****************/
- pascal Boolean _ChooseResType2ModalProc( _theDialogP, _theEvent, _itemHit )
- DialogPtr _theDialogP;
- EventRecord *_theEvent;
- int *_itemHit;
- {char key;
- int _itemType, _part;
- Handle _itemH;
- Rect _itemRect;
- GrafPort *_savePort;
- Boolean _answer;
-
- GetPort( &_savePort );
- SetPort( _theDialogP );
- _answer = FALSE;
- if ((_theEvent->what == keyDown) || (_theEvent->what == autoKey))
- { key = _theEvent->message & charCodeMask;
- switch (key)
- { case 0x03: /* enter char */
- case 0x0D: /* return char */
- GetDItem( _theDialogP, CHOOSE_RESTYPE2_DLOG_OK_ITEM,
- &_itemType, &_itemH, &_itemRect );
- _FlashControl( (ControlHandle)_itemH );
- *_itemHit = CHOOSE_RESTYPE2_DLOG_OK_ITEM;
- _answer = TRUE;
- break;
- case '.':
- if ((_theEvent->modifiers & cmdKey) != 0)
- { GetDItem( _theDialogP, CHOOSE_RESTYPE2_DLOG_CANCEL_ITEM,
- &_itemType, &_itemH, &_itemRect );
- _FlashControl( (ControlHandle)_itemH );
- *_itemHit = CHOOSE_RESTYPE2_DLOG_CANCEL_ITEM;
- _answer = TRUE;
- }
- break;
- }
- if (!_answer)
- { /* can do some character screening here if desired */
- }
- }
- SetPort( _savePort );
- return( _answer );
- }
-
-
-
-
-
-
- /*********************** My Modal Proc *****************/
- pascal Boolean _MyModalProc( _theDialogP, _theEvent, _itemHit )
- DialogPtr _theDialogP;
- EventRecord *_theEvent;
- int *_itemHit;
- {char key;
- int _itemType, _part, _selected, _numElements, i, _top;
- Handle _itemH;
- Rect _itemRect;
- GrafPort *_savePort;
- Boolean _answer;
- Point _cSize;
-
- GetPort( &_savePort );
- SetPort( _theDialogP );
- _answer = FALSE;
- if (_theEvent->what == mouseDown)
- { _gWhere = _theEvent->where;
- GlobalToLocal( &_gWhere );
- _gModifiers = _theEvent->modifiers;
-
- /* uncomment this for to ignore clicks in the list */
- /* if (PtInRect(_gWhere,&_gListRect))
- { _answer = TRUE;
- *_itemHit = 0;
- }
- */
- }
- else if ((_theEvent->what == keyDown) || (_theEvent->what == autoKey))
- { key = _theEvent->message & charCodeMask;
- switch (key)
- { case 0x03: /* enter char */
- case 0x0D: /* return char */
- GetDItem( _theDialogP, ARE_YOU_SURE_DLOG_OK_ITEM,
- &_itemType, &_itemH, &_itemRect );
- _FlashControl( (ControlHandle)_itemH );
- *_itemHit = ARE_YOU_SURE_DLOG_OK_ITEM;
- _answer = TRUE;
- break;
- case '.':
- if ((_theEvent->modifiers & cmdKey) != 0)
- { GetDItem( _theDialogP, ARE_YOU_SURE_DLOG_CANCEL_ITEM,
- &_itemType, &_itemH, &_itemRect );
- _FlashControl( (ControlHandle)_itemH );
- *_itemHit = ARE_YOU_SURE_DLOG_CANCEL_ITEM;
- _answer = TRUE;
- }
- else
- SysBeep(20);
- break;
- case 'a':
- case 'A':
- if (((_theEvent->modifiers & cmdKey) != 0) && _gAll)
- { GetDItem( _theDialogP, ARE_YOU_SURE_DLOG_ALL_ITEM,
- &_itemType, &_itemH, &_itemRect );
- _FlashControl( (ControlHandle)_itemH );
- *_itemHit = ARE_YOU_SURE_DLOG_ALL_ITEM;
- _answer = TRUE;
- }
- else
- SysBeep(20);
- break;
- case MOVE_DOWN_ARROW_CHAR:
- case MOVE_RIGHT_ARROW_CHAR:
- _cSize.h = 0;
- _cSize.v = 0;
- if (LGetSelect( TRUE, &_cSize, _gListH ))
- { _selected = _cSize.v;
- _numElements = (*_gListH)->dataBounds.bottom;
- while ((_cSize.v < _numElements) &&
- (LGetSelect( TRUE, &_cSize, _gListH )))
- { if (((_theEvent->modifiers & shiftKey) == 0) ||
- (!_gAll))
- LSetSelect( FALSE, _cSize, _gListH );
- _selected = _cSize.v++;
- }
- if (_selected < _numElements-1)
- _selected++;
- if (((_theEvent->modifiers & cmdKey) != 0) ||
- (key == MOVE_RIGHT_ARROW_CHAR))
- { for (i=_selected; i<_numElements; i++)
- { _cSize.v = i;
- LSetSelect( TRUE, _cSize, _gListH );
- }
- _selected = _numElements-1;
- }
- _cSize.v = _selected;
- LSetSelect( TRUE, _cSize, _gListH );
- if ((*_gListH)->visible.bottom-1 < _selected)
- LScroll( 0, _selected-(*_gListH)->visible.bottom+1,
- _gListH );
- *_itemHit = 0;
- _answer = TRUE;
- }
- break;
- case MOVE_UP_ARROW_CHAR:
- case MOVE_LEFT_ARROW_CHAR:
- _cSize.h = 0;
- _cSize.v = 0;
- if (LGetSelect( TRUE, &_cSize, _gListH ))
- { _numElements = (*_gListH)->dataBounds.bottom;
- _selected = _cSize.v;
- if (((_theEvent->modifiers & shiftKey) == 0)||(!_gAll))
- for (i=_selected; i<_numElements; i++)
- { _cSize.v = i;
- LSetSelect( FALSE, _cSize, _gListH );
- }
- if (_selected > 0)
- _selected--;
- if (((_theEvent->modifiers & cmdKey) != 0) ||
- (key == MOVE_LEFT_ARROW_CHAR))
- { _selected = 0;
- if (((_theEvent->modifiers & shiftKey) != 0) &&
- (_gAll))
- { _top = _cSize.v;
- for (i=0; i<_top; i++)
- { _cSize.v = i;
- LSetSelect( TRUE, _cSize, _gListH );
- }
- _cSize.v = _top;
- }
- }
- _cSize.v = _selected;
- LSetSelect( TRUE, _cSize, _gListH );
- if ((*_gListH)->visible.top > _selected)
- LScroll( 0, _selected-(*_gListH)->visible.top,
- _gListH );
- *_itemHit = 0;
- _answer = TRUE;
- }
- break;
- default:
- SysBeep(20);
- break;
- }
- }
- SetPort( _savePort );
- return( _answer );
- }
-
-
-
-
-
-
-